﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace RCREEE.Library.Entities
{
    public class CountryDetails
    {

        #region private variables

        private int _CountryId;
        private int _LanguageCode;
        private String _CountryName;
        private float _RenewableEnergyContributionRate;
        private String _RenewableEnergyContributionRateComment;
        private float _EnergyEfficiencyContributionRate;
        private String _EnergyEfficiencyContributionRateComment;
        private String _Currency;


        #endregion

        #region Public Properties
        public int CountryId
        {
            get { return _CountryId; }
            set { _CountryId = value; }
        }


        public int LanguageCode
        {
            get { return _LanguageCode; }
            set { _LanguageCode = value; }
        }


        public String CountryName
        {
            get { return _CountryName; }
            set { _CountryName = value; }
        }


        public float RenewableEnergyContributionRate
        {
            get { return _RenewableEnergyContributionRate; }
            set { _RenewableEnergyContributionRate = value; }
        }


        public String RenewableEnergyContributionRateComment
        {
            get { return _RenewableEnergyContributionRateComment; }
            set { _RenewableEnergyContributionRateComment = value; }
        }


        public float EnergyEfficiencyContributionRate
        {
            get { return _EnergyEfficiencyContributionRate; }
            set { _EnergyEfficiencyContributionRate = value; }
        }


        public String EnergyEfficiencyContributionRateComment
        {
            get { return _EnergyEfficiencyContributionRateComment; }
            set { _EnergyEfficiencyContributionRateComment = value; }
        }


        public String Currency
        {
            get { return _Currency; }
            set { _Currency = value; }
        }

        #endregion

        #region Constructor
        public CountryDetails() { }
        #endregion

        #region PublicMethods
        /// <summary>
        /// Calling Function from DataManger 
        /// </summary>
        /// <param name="LanguageCode">from session </param>
        /// <returns>Datatable</returns>
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public DataTable SelectRenewableEnergey(int LanguageCode)
        {
            try { return DataManager.SelectRenewableEnergey(LanguageCode); }
            catch (Exception)
            { return null; }
        }
        public DataTable SelectCountryRenewableEnergey(int CountryId)
        {
            try { return DataManager.SelectCountryRenewableEnergey(CountryId); }
            catch (Exception)
            { return null; }
        }
        public DataTable SelectCountryEnergyEfficiency(int CountryId)
        {
            try { return DataManager.SelectCountryEnergyEfficiency(CountryId); }
            catch (Exception)
            { return null; }
        }
        /// <summary>
        /// Calling Function from DataManger 
        /// </summary>
        /// <param name="LanguageCode">from session </param>
        /// <returns>Datatable</returns>
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public DataTable SelectEnergyEfficiency(int LanguageCode)
        {
            try { return DataManager.SelectEnergyEfficiency(LanguageCode); }
            catch (Exception)
            { return null; }
        }

        public int UpdateRenewable(List<CountryDetails> CD)
        {
            try {
                return DataManager.UpdateRenewable(CD);
            
            }
            catch (Exception ex)
            { return 0; }
        }

        public int UpdateEnergy(List<CountryDetails> CD)
        {
            try
            {
                return DataManager.UpdateEnergyEfficiency(CD);

            }
            catch (Exception ex)
            { return 0; }
        }
        #endregion

        #region private Method

        #endregion

        #region Override

        /// <summary>
        /// override Method to return Name of Country
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return CountryName;
        }
        #endregion
    }
}
